package manaul;
import java.util.ArrayList;
import java.util.Scanner;
import javax.swing.*;
import edu.princeton.cs.algs4.StdDraw;
import edu.princeton.cs.algs4.StdIn;
import edu.princeton.cs.algs4.StdOut;

public class C1_32 {

	 private static void createAndShowGUI() {
	        // 确保一个漂亮的外观风格
	        JFrame.setDefaultLookAndFeelDecorated(true);

	        // 创建及设置窗口
	        JFrame frame = new JFrame("HelloWorldSwing");
	        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

	        // 添加 "Hello World" 标签
	        JLabel label = new JLabel("Hello World");
	        frame.getContentPane().add(label);

	        // 显示窗口
	        frame.pack();
	        frame.setVisible(true);
	    }
	public static void main(String[] args) {
		// TODO 自动生成的方法存根
		StdOut.print("input numbers Y want to cata");
		ArrayList<Double> cata=new ArrayList<>();
		 Scanner input=new Scanner(System.in);
		while (input.hasNextDouble()) {
			cata.add(input.nextDouble());
		}
		StdOut.print("input N,and l,r");
		int N=StdIn.readInt();
		double l=StdIn.readDouble();
		double r=StdIn.readDouble();
		for (int i = 0; i < N; i++) {
			int tempforM=0;
			for (int j = 0; j < cata.size(); j++) {
				StdOut.println((i*(l-r)/N+r));
				StdOut.println(cata.get(j));
				if (cata.get(j)>=(i*(l-r)/N+r)&&cata.get(j)<=((i+1)*(l-r)/N+r)) {
					tempforM=tempforM+1;
				}
				StdOut.println(tempforM);
			StdDraw.filledRectangle((i+0.5)/10, tempforM*0.1, 0.005, 0.1);
			}
			/*
			javax.swing.SwingUtilities.invokeLater(new Runnable() {
	            public void run() {
	                createAndShowGUI();
	            }
	        });
	        */
		}
		
	}

}

